package cn.edu.swu.core;

import jakarta.servlet.http.HttpServlet;

public abstract class BasicServlet extends HttpServlet {


    protected String wrapPage(String pageContent){
        StringBuilder sb;
        sb = new StringBuilder();
        sb.append("<!DOC-TYPE html>")
                .append("<html lang=\"en\">")
                .append("<head><meta charset=\"UTF-8\"><title>西南大学网上书店</title>")
                .append("<link rel=\"stylesheet\" href=\"/bookstore/css/bookstore.css\">")
                .append("</head>")
                .append("<body>")
                .append("<div style=\"width:99%;background-color:#336699;color:#ffffff\"><marquee><h2>欢迎访问西南大学网上书店</h2></marquee></div>")
                .append("<center>")
                .append("<div class='menu'>")
                .append("<a class='menu_item' href='/bookstore/book/list'>显示图书</a>")
                .append("<a class='menu_item' href='/bookstore/add_book.html'>添加图书</a>")
                .append("<form action='/bookstore/book/search' method='get' class='menu_item'>" +
                        "<input type='text' name= 'key'>&nbsp;&nbsp;&nbsp;" +
                        "<input type='submit' value='查询'>;" +
                        "</form>")
                .append("</div>")
                .append(pageContent)
                .append("</center>")
                .append("</body>")
                .append("</html>");
        return sb.toString();
    }


}
